From: Jonathan Dieter Date: Thu, 10 May 2018 11:41:55 +0000 (+0300) Subject: Change zck_range_get_char to not output header beginning X-Git-Tag: archive/raspbian/1.1.9+ds1-1+rpi1~1^2~280 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=1cd938afe69d873f62c8896333205f852f155a3a;p=zchunk.git Change zck_range_get_char to not output header beginning Signed-off-by: Jonathan Dieter --- diff --git a/src/lib/dl/dl.c b/src/lib/dl/dl.c index 77cf781..acbbd9e 100644 --- a/src/lib/dl/dl.c +++ b/src/lib/dl/dl.c @@ -319,24 +319,19 @@ int zck_dl_range_chk_chunk(zckDL *dl, char *url, int is_chunk) { CURLcode res; for(int i=0; iinfo.segments; i++) { - struct curl_slist *header = NULL; - if(dl->priv->dl_regex != NULL) zck_dl_free_dl_regex(dl); if(dl->boundary != NULL) free(dl->boundary); - zck_log(ZCK_LOG_DEBUG, "%s\n", ra[i]); - header = curl_slist_append(header, ra[i]); curl_easy_setopt(dl->priv->curl_ctx, CURLOPT_URL, url); curl_easy_setopt(dl->priv->curl_ctx, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(dl->priv->curl_ctx, CURLOPT_HEADERFUNCTION, get_header); curl_easy_setopt(dl->priv->curl_ctx, CURLOPT_HEADERDATA, dl); curl_easy_setopt(dl->priv->curl_ctx, CURLOPT_WRITEFUNCTION, dl_write_data); curl_easy_setopt(dl->priv->curl_ctx, CURLOPT_WRITEDATA, dl); - curl_easy_setopt(dl->priv->curl_ctx, CURLOPT_HTTPHEADER, header); + curl_easy_setopt(dl->priv->curl_ctx, CURLOPT_RANGE, ra[i]); res = curl_easy_perform(dl->priv->curl_ctx); - curl_slist_free_all(header); free(ra[i]); if(res != CURLE_OK) { diff --git a/src/lib/dl/range.c b/src/lib/dl/range.c index 3aef909..6580be1 100644 --- a/src/lib/dl/range.c +++ b/src/lib/dl/range.c @@ -188,13 +188,8 @@ char *zck_range_get_char(zckRangeItem **range, int max_ranges) { return NULL; } - if(snprintf(output, 20, "Range: bytes=") > 20) { - free(output); - zck_log(ZCK_LOG_ERROR, "Error writing range\n"); - return NULL; - } - int loc = strlen(output); - int count=0; + int loc = 0; + int count = 0; while(*range) { int length = snprintf(output+loc, buf_size-loc, "%lu-%lu,", (long unsigned)(*range)->start,